<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>Icon Angular Meter</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1">Icon Angular Meter</p>
<hr class="separator">
<div class="content">
<img src="images/iconameter.png" width='70' height='90'>
<br><br>
This example demonstrates a fuel-tank like meters, in which the meter is labelled by an icon and the scale shows text abbreviations.<br><br>
The scale labels on the meter is created by using <a href="BaseMeter.setScale2.htm">BaseMeter.setScale2</a>. The icon is created by adding a text box with <a href="BaseChart.addText.htm">BaseChart.addText</a> and using <a href="cdml.htm">CDML</a> to specify an icon.
</div>
<p class="heading1a">Source Code Listing</p>
<div class="content">
<b>[JSP Version]</b> jspdemo/iconameter.jsp
<div class='codeblock'><code class='pre'>&lt;%@page import="ChartDirector.*, java.util.*" %&gt;
&lt;%
// The value to display on the meter
double value = 85;

// Create an AugularMeter object of size 70 x 90 pixels, using black background with a 2 pixel 3D
// depressed border.
AngularMeter m = new AngularMeter(70, 90, 0, 0, -2);

//Set search path to current JSP directory for loading icon images
m.setSearchPath(getServletConfig().getServletContext(), request);

// Use white on black color palette for default text and line colors
m.setColors(Chart.whiteOnBlackPalette);

// Set the meter center at (10, 45), with radius 50 pixels, and span from 135 to 45 degrees
m.setMeter(10, 45, 50, 135, 45);

// Set meter scale from 0 - 100, with the specified labels
String[] labels = {"E", " ", " ", " ", "F"};
m.setScale2(0, 100, labels);

// Set the angular arc and major tick width to 2 pixels
m.setLineWidth(2, 2);

// Add a red zone at 0 - 15
m.addZone(0, 15, 0xff3333);

// Add an icon at (25, 35)
m.addText(25, 35, "&lt;*img=gas.png*&gt;");

// Add a yellow (ffff00) pointer at the specified value
m.addPointer(value, 0xffff00);

// Output the chart
WebChartViewer viewer = new WebChartViewer(request, "chart1");
viewer.setChart(m, Chart.SVG);
%&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Icon Angular Meter&lt;/title&gt;
    &lt;!-- Include ChartDirector Javascript Library to support chart interactions --&gt;
    &lt;script type="text/javascript" src="cdjcv.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body style="margin:5px 0px 0px 5px"&gt;
    &lt;div style="font:bold 18pt verdana;"&gt;
        Icon Angular Meter
    &lt;/div&gt;
    &lt;hr style="border:solid 1px #000080; background:#000080" /&gt;
    &lt;div style="font:10pt verdana; margin-bottom:1.5em"&gt;
        &lt;a href="viewsource.jsp?file=&lt;%=request.getServletPath()%&gt;"&gt;View Source Code&lt;/a&gt;
    &lt;/div&gt;
    &lt;!-- ****** Here is the chart image ****** --&gt;
    &lt;%= viewer.renderHTML(response) %&gt;
&lt;/body&gt;
&lt;/html&gt;</code></div>
</div>
<br><hr class="separator"><div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
